<template>
  <!-- 流程详情弹窗 -->
  <el-dialog title="流程详情" :visible.sync="ProcessDesc" center width="80%" custom-class="ProcessDesc-dialog" :close-on-click-modal="false">
    <ul class="ProcessDesc">
      <li class="list-wrapper" v-for="(item, index) in ProcessList" :key="index">
        <!-- 流程节点为开始与结束的，class为start与over。流程当前节点为数组最后一条数据，判断数组最后一条数据状态是否为结束，不是结束class为now，是结束class为over -->
        <div class="list" :class="
        index=='0'?'start':'' || 
        index == ProcessList.length-1 && item.activityName != '结束'?'now':'' || 
        item.activityName =='结束' ?'over':''">
          <p>{{item.assignee}}</p>
          <span>{{item.activityName}}</span>
          <!-- 当前节点不为结束状态时，显示当前审核人，为结束状态时，隐藏 -->
          <div class="assignee" v-if="index == ProcessList.length-1 && item.activityName !='结束'">当前审核人：{{item.assignee}}</div>
        </div>
      </li>
      <!-- 数组最后一条数据状态不为结束时，显示标签 -->
      <li class="list-wrapper" v-if="ProcessList.length>0 && ProcessList[ProcessList.length-1].activityName !='结束'">
        <div class="list over">
          <p>完成</p>
          <span>审核</span>
        </div>
      </li>
    </ul>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      ProcessDesc: false,
      ProcessList: []
    }
  },
  methods: {
    getData(list, open) {
      this.ProcessList = list
      this.ProcessDesc = open
    }
  }
}
</script>

<style lang="scss">
  .ProcessDesc {
    width: 90%;
    margin: 0 auto;
    overflow: hidden;
    overflow-x: auto;
    white-space: nowrap;
    padding: 0 0 1rem;
    text-align: center;
    .list-wrapper {
      position: relative;
      display: inline-block;
      .list {
        min-width: 1rem;
        height: 0.6rem;
        background: #66B1FF;
        border-radius: 0.05rem;
        text-align: center;
        color: #fff;
        display: flex;
        flex-flow: column;
        align-items: center;
        justify-content: center;
        padding: 0.1rem;
        margin: 0 0.5rem;
        position: relative;
        >p {
          font-size: 0.16rem;
          font-weight: bold;
          margin: 0;
        }
        >span {
          font-size: 0.14rem;
        }
        .assignee {
          position: absolute;
          bottom: -0.5rem;
          color: #66B1FF;
          font-weight: bold;
          font-size: 0.16rem;
        }
      }
      .list::before {
        content: '';
        width: 0.95rem;
        position: absolute;
        right: -0.95rem;
        top: 50%;
        border-bottom: 0.03rem solid #409EFF;
      }
      .start,
      .over {
        background: #00B050;
      }
      .now {
        background: #ED7D31;
        margin-right: 1rem;
      }
      .now::before {
        border-bottom: 0.04rem dotted #409EFF;
        width: 1.2rem;
        right: -1.28rem;
      }
      .start {margin-left: 0;}
      .over {margin-right: 0;}
      .over::before {display: none;}
    }
    .list-wrapper::after {
      content: '>';
      color: #409EFF;
      font-size: 0.28rem;
      font-weight: bold;
      right: -0.5rem;
      top: 0.16rem;
      position: absolute;
    }
    .list-wrapper:nth-last-of-type(1)::after {
      display: none;
    }
  }
</style>